package com.deppon.vts.micro.login;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import tk.mybatis.mapper.entity.Example;

import com.deppon.vts.data.model.TVmVehicle;
import com.deppon.vts.data.mybatis.mapper.TVmVehicleMapper;
import com.deppon.vts.micro.exception.BizException;
import com.deppon.vts.micro.login.bean.PersonalArrivalRequestEntity;
import com.deppon.vts.micro.login.bean.PersonalArrivalResponseEntity;
import com.deppon.vts.micro.service.biz.bean.BizContext;
import com.deppon.vts.micro.service.logic.LogicArrivalService;

/**
 * 文件下载服务
 * @author jfast
 *
 */
public class PersonalArrivalLogicService extends LogicArrivalService<PersonalArrivalRequestEntity, PersonalArrivalResponseEntity> {
	
	private Logger log = LoggerFactory.getLogger(PersonalArrivalLogicService.class);
	
	@Autowired
	private TVmVehicleMapper tVmVehicleMapper;
	
	public void processRequest(
			BizContext<PersonalArrivalRequestEntity, PersonalArrivalResponseEntity> context)
			throws BizException {
		log.info("车辆 {} 发起到达请求", context.getRequest().getVehicleNo());
		Example example = new Example(TVmVehicle.class);
		example.createCriteria().andCondition("vehicleNo = "+context.getRequest().getVehicleNo());
		tVmVehicleMapper.selectByExample(example);
		//TODO 发起基站定位
		context.getResponse().setErrCode("0");
		context.getResponse().setErrMsg("成功");
		sendJson(context);
	}

}
